package com.yznote.cloudesk.common.tokenShare;

import com.yznote.cloudesk.common.pojo.User;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component
public class YTokenShare {
    private HashMap<Thread,User> tokens;
    public YTokenShare(){
        this.tokens = new HashMap<>();
    }
    public User get(){
        return tokens.get(Thread.currentThread());
    }
    public void put(User user){
        tokens.put(Thread.currentThread(),user);
    }
    public void delete(){
        tokens.remove(Thread.currentThread());
    }
}
